;(function() {
		init_parsley();
		$.fn.modal.Constructor.prototype.enforceFocus = function () { };
		$('.js-data-example-ajax').select2({
	    	placeholder: "请至少输入2个字符",
	    	minimumInputLength: 2 ,
	    	ajax:{
	    		delay:300,
	    		url:"/gym/GymPtOrder/ajax_seach_data",
	    		data:function(param){
	    			var query={
	    				q:param.term,
	    				t:123456,
						a:1,
						member_id:$('#old_member_id').val()
	    			}
	    			return query;
	    		},
	    		processResults: function (data) {
				    return {
				      results: data
				    };
  				},
	    	}
	    })
	   	$("#form-submit").click(function(){
	   		var flag=$('#validate-form').parsley('validate' );
	   		if(flag){
	   			$.post(
	   				"/gym/GymPtOrder/transfer_post",
	   				$("#validate-form").serialize(),
	   				function(data){
			      		if(data.flag){
			      			$("#myModal").modal("hide");
			      			toastr['success']("操作成功！", ''); 
			      			$("#myform #btn-advanced-refresh").trigger("click");// 刷新页面
			      		}else{
			      		 	toastr['error'](data.msg,"操作失败！"); 
			      		}
	   				}
	   			);
	   		}
	   	})
})();
